|
HOT TIP: you can freely browse the site while music plays

Loading...
entropy.fi - Stripe integration

Estimated reading time: 2min 19s
Created: 29.11.2023, 12:37 - Updated: 29.10.2024, 18:06
22.11.2023, 20:00

Background

For the e30v event, an online payment system was needed for ticket sales. In previous events, ticket sales had been arranged through third-party systems, through Holvi, or traditionally through online banking. However, for this event, seamless integration with Stripe, a payment transfer system, was desired. The goal of the integration was to enable quick and easy payments. So, in this project, I built a Stripe integration for the e30v event on Entropy's website.

Challenge

Typically, the challenge in online ticket sales is the limited number of tickets and several simultaneous users. How to prevent tickets from being sold more than a limited number, especially if the site is used by several hundred people at the same time?

Solution

I tracked the number of tickets using information about tickets sold and Stripe purchase intentions. So I didn't reserve tickets for the user when the ticket was added to the shopping cart. I trusted that the server was fast enough to check what was needed when making purchase intent.

Integration implementation

There is nothing miraculous about the Stripe integration itself. First, we create a purchase intent for Stripe from the items in user's shopping cart on the server side and send it to the user. Once the intention has been made, the user has 30 minutes to pay for the contents of the shopping cart. Now for the hard part: the server needs to be able to track these purchase intentions to other users so that there is no overselling.

When ticket sales started, I published the tickets so that I specified the total number of tickets for each ticket type. I started with more expensive tickets, moving on to the cheapest ticket types. I tried to aim for the cheapest ones to be on sale exactly at the promised time. There were 30 of the cheapest tickets available. When ticket sales began, there were hundreds of people on the site. I didn't notice any signs of slowing down on the site. All of these 30 tickets were sold the minute they were allowed to be purchased.

After all, one ticket was oversold. This was because when one ticket remained, two users pressed the buy button at exactly the same time. As a result, purchase intentions were not aware of each other, and therefore sales could not be prevented at the server end.

So now Entropy's website has Stripe integration, which handles payment transactions. It was fun exercise to do.